//
//  ViewController.m
//  UI18_StatusBar(状态栏)
//
//  Created by Scott on 16/4/1.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *buttonOfChange;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark - 知识点: 状态栏颜色
/** 重写方法. */
- (UIStatusBarStyle)preferredStatusBarStyle {
    
    if (self.buttonOfChange.isSelected) {
        
        return UIStatusBarStyleDefault;
        
    } else {
        
        // 亮色.
        return UIStatusBarStyleLightContent;
    }
}


- (IBAction)handleChangeStatusBarStyle:(id)sender {
    
    UIButton *button = (UIButton *)sender;
    
    // 状态取反.
    button.selected = !button.selected;
    
    // 更改(更新)状态栏颜色.
    [self setNeedsStatusBarAppearanceUpdate];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
